package com.bat.controller;

import com.bat.domain.service.HomeService;
import com.bat.domain.service.RoleService;
import com.bat.util.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: eureka-server
 * @description:
 * @author: zhoupengfei
 * @create: 2019-09-12 16:20
 **/
@RestController
@Slf4j
@Api("测试")
@RequestMapping("/")
public class HomeController {

    @Resource
    private HomeService homeService;
    @Resource
    private RoleService roleService;

    @ApiOperation("首页")
    @GetMapping("/index")
    public R index(){
        return R.s();
    }

    @ApiOperation("测试mybatis-plus")
    @GetMapping("/test/mp")
    public R<List> testMybatis(){
        return  R.s(homeService.userList());
    }

    @ApiOperation("测试事务")
    @GetMapping("/test/transaction")
    public R<List> testTransaction() {
        return R.s(roleService.insert());
    }


}